<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Store</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
    <div class="banner">
        
        <h1>
            <span class="type">Class</span>
            Store
            
                <span class="parent">&lt;
                    
                    ActiveRecord::Base
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/app/models/store_rb.html">app/models/store.rb</a></li>
            
            <li><a href="../files/app/models/store/friendable_rb.html">app/models/store/friendable.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  
    <!-- Namespace -->
    <div class="sectiontitle">Namespace</div>
    <ul>
      
        <li>
          <span class="type">MODULE</span>
          <a href="Store/Friendable.html">Store::Friendable</a>
        </li>
      
    </ul>
  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>C</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-cache_key">cache_key</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>O</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-order_tel_phone">order_tel_phone</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-set_from">set_from</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>U</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="#method-i-unfriend">unfriend</a>,
              </li>
            
              
              <li>
                <a href="#method-i-url">url</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  
    <!-- Includes -->
    <div class="sectiontitle">Included Modules</div>
    <ul>
      
        <li>
          
            <a href="Store/Friendable.html">
              Store::Friendable
            </a>
          
        </li>
      
        <li>
          
            <a href="Image.html">
              Image
            </a>
          
        </li>
      
    </ul>
  



  

    

    

    


    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-cache_key">
            
              <b>cache_key</b>()
            
            <a href="../classes/Store.html#method-i-cache_key" name="method-i-cache_key" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-cache_key_source')" id="l_method-i-cache_key_source">show</a>
                
              </p>
              <div id="method-i-cache_key_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/store.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">cache_key</span>
  <span class="ruby-node">&quot;store_friend:#{self.id}&quot;</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-order_tel_phone">
            
              <b>order_tel_phone</b>()
            
            <a href="../classes/Store.html#method-i-order_tel_phone" name="method-i-order_tel_phone" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-order_tel_phone_source')" id="l_method-i-order_tel_phone_source">show</a>
                
              </p>
              <div id="method-i-order_tel_phone_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/store.rb, line 47</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">order_tel_phone</span>
  <span class="ruby-identifier">tel_phone</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">phone</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-set_from">
            
              <b>set_from</b>()
            
            <a href="../classes/Store.html#method-i-set_from" name="method-i-set_from" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-set_from_source')" id="l_method-i-set_from_source">show</a>
                
              </p>
              <div id="method-i-set_from_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/store.rb, line 31</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">set_from</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">store_basic_info</span>.<span class="ruby-identifier">set_from</span>.<span class="ruby-identifier">try</span>(<span class="ruby-value">:strftime</span>, (<span class="ruby-string">&quot;%Y-%m-%d&quot;</span>))
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-unfriend">
            
              <b>unfriend</b>(friend)
            
            <a href="../classes/Store.html#method-i-unfriend" name="method-i-unfriend" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-unfriend_source')" id="l_method-i-unfriend_source">show</a>
                
              </p>
              <div id="method-i-unfriend_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/store/friendable.rb, line 38</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">unfriend</span>(<span class="ruby-identifier">friend</span>)
  <span class="ruby-identifier">fid</span> = <span class="ruby-identifier">friend</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Store</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">friend</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">friend</span>
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">transaction</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">friend_ids</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">fid</span>)
    <span class="ruby-identifier">friend</span>.<span class="ruby-identifier">friend_ids</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">id</span>)
    <span class="ruby-keyword">self</span>.<span class="ruby-identifier">save!</span>
    <span class="ruby-identifier">friend</span>.<span class="ruby-identifier">save!</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-url">
            
              <b>url</b>()
            
            <a href="../classes/Store.html#method-i-url" name="method-i-url" class="permalink">Link</a>
          </div>

          
            <div class="description">
              
            </div>
          

          

          

          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source:
                <a href="javascript:toggleSource('method-i-url_source')" id="l_method-i-url_source">show</a>
                
              </p>
              <div id="method-i-url_source" class="dyn-source">
                <pre><span class="ruby-comment"># File app/models/store.rb, line 39</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">url</span>
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">img</span>.<span class="ruby-identifier">present?</span>
    <span class="ruby-node">&quot;#{$qiniu_config[:host]}/#{img}&quot;</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-string">&quot; &quot;</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>
